<%@ page contentType="text/html;charset=utf-8"%>
<%@ page import="com.zfsoft.dao.DAO"%>
<%@ page import="java.util.*"%>
<%@page import="net.sf.json.*"%>
<%
    request.setCharacterEncoding("UTF-8");
    response.setCharacterEncoding("UTF-8");

    // 对应的是正在展开的节点id
    String node = request.getParameter("node");
    System.out.println(node);

  String sql="";
  JSONArray content ;
  List list =new ArrayList();

    if ("0".equals(node)) {
   		sql="select 'b'||xydm id,xymc text  from xydmb where ssbm is null  order by xydm";
    	 list =new DAO().getList(sql, new String[]{}, new String[]{"id","text"});
    	 content = JSONArray.fromObject( list ); 
    } else {
    	sql ="select yhm id,xm text,'true' leaf  from bmryxx_view where xydm =?  order by yhm ";
    	List  list1 =new DAO().getList(sql, new String[]{node.replace("b","")}, new String[]{"id","text","leaf"});
    	 for(int i=0;i<list1.size();i++){
    		 list.add(list1.get(i));
    	 }
    	 sql="select 'b'||xydm id,xymc text  from xydmb where ssbm =?  order by xydm ";
    	 list1 =new DAO().getList(sql, new String[]{node.replace("b","")}, new String[]{"id","text"});
    	 for(int i=0;i<list1.size();i++){
    		 list.add(list1.get(i));
    	 }
    	 content = JSONArray.fromObject( list ); 
    } 
    response.getWriter().print(content.toString());
%>